//
//  LGTabBarController.m
//  LiangCang
//
//  Created by MS on 15-12-15.
//  Copyright (c) 2015年 Lemon. All rights reserved.
//

#import "LGTabBarController.h"
#import "MyTabbar.h"
#import "LGRootViewController.h"
#import "LGNavigationController.h"
#import "LoginController.h"
@interface LGTabBarController ()<UITabBarControllerDelegate>

@end

@implementation LGTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView * smarkView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)];
    smarkView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:smarkView];
    self.smarkView = smarkView;
    
    self.delegate = self;
    
    NSArray *vcTitleArray = @[@"LGHome",@"LGCategory",@"LGDiscover",@"LGProfile"];
   
    for(NSString *title in vcTitleArray)
    {
        LGRootViewController *vc = [[NSClassFromString([NSString stringWithFormat:@"%@Controller",title]) alloc] init];
        
        LGNavigationController *nav = [[LGNavigationController alloc] initWithRootViewController:vc];
        [self addChildViewController:nav];

    }
    
    MyTabbar * tabBar = [MyTabbar sharedMyTabbar];
    [tabBar createMyTabbarWithTabbarController:self];
    tabBar.frame = self.tabBar.bounds ;
    [self.tabBar addSubview:tabBar];
    
    self.selectedIndex = 0;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
